package com.yang.newCustomersTransferBackProcess.service;

import com.alibaba.fastjson.JSON;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Service
public class ClimbingDoubanService {

    public void climbingDouban() {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 10, 200, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(5));

        for (int i = 0; i < 15; i++) {
            int p = i;
            executor.execute(() -> {
                CloseableHttpClient client = HttpClients.createDefault();    //创建一个http客户端

                HttpGet httpGet = new HttpGet("https://movie.douban.com/j/search_subjects?type=movie&tag=悬疑&sort=time&page_limit=20&page_start="+Integer.toString(p));// 通过httpGet方式来实现我们的get请求

                httpGet.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36 SE 2.X MetaSr 1.0");//伪装成浏览器请求

                try {
                    CloseableHttpResponse response = client.execute(httpGet);
                    HttpEntity entity = response.getEntity();
                    if (entity != null) {
                        // 利用从HttpEntity中得到的String生成JsonObject
                        Map<String, Object> result = JSON.parseObject(EntityUtils.toString(entity));
                        System.out.println("result：" + result);
                    }

                } catch (IOException e) {
                    e.printStackTrace();
                }
            });
        }
        executor.shutdown();
    }

    public void xyApi(){
        CloseableHttpClient client = HttpClients.createDefault();    //创建一个http客户端

        HttpPost httpPost = new HttpPost("http://xy-api-gray.lvshou.com/xy-order/order/Customer/cValidate");
        httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        httpPost.setHeader("token", "8691ca19-afd7-426f-ad6d-d861fddbb7b2");

        List<NameValuePair> pairs = new ArrayList<>();
        pairs.add(new BasicNameValuePair("userAccount", "150604411650091"));//BasicNameValuePair放入键值对
        pairs.add(new BasicNameValuePair("type", "2"));
        //创建表单的Entity对象
        UrlEncodedFormEntity formEntity = null;
        try {
            //参数1是封装好的表单数据，参数二是编码格式
            formEntity = new UrlEncodedFormEntity(pairs, "UTF-8"); //使UTF-8封装
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        //表单的Entity对象放入到post中
        httpPost.setEntity(formEntity);

        try {
            CloseableHttpResponse response = client.execute(httpPost);
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                // 利用从HttpEntity中得到的String生成JsonObject
                Map<String, Object> result = JSON.parseObject(EntityUtils.toString(entity));
                System.out.println("resultXyApi：" + result);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void xyJsonApi(){
        CloseableHttpClient client = HttpClients.createDefault();    //创建一个http客户端

        HttpPost httpPost = new HttpPost("http://127.0.0.1:0007/web/custom");
        httpPost.setHeader("Accept", "application/json");
        httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
        httpPost.setHeader("token", "8691ca19-afd7-426f-ad6d-d861fddbb7b2");
        String params = "[\n" +
                "    {\n" +
                "        \"Id\": 1,\n" +
                "        \"Name\": \"覆海大圣\",\n" +
                "        \"Age\": 0,\n" +
                "        \"Meallist\": [\n" +
                "            {\n" +
                "                \"Id\": 3,\n" +
                "                \"Name\": \"永葆青春套餐\",\n" +
                "                \"ProjectList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"异域风情\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"异域风情\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"ProductList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"活力丹\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"养颜\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"玫瑰精华乳\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"美白水\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"美白\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"润肤精油\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"活力丹\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"养颜\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"玫瑰精华乳\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"美白水\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"美白\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"润肤精油\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"Id\": 2,\n" +
                "                \"Name\": \"青春无限套餐\",\n" +
                "                \"ProjectList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"激光美白\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"仪器类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"形体塑造\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"美体类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:18:00+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:18:00+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:18:00+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:18:00+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"ProductList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"美白水\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"美白\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"润肤精油\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"玫瑰精华乳\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"Id\": 2,\n" +
                "        \"Name\": \"青鸾火凤\",\n" +
                "        \"Age\": 0,\n" +
                "        \"Meallist\": [\n" +
                "            {\n" +
                "                \"Id\": 1,\n" +
                "                \"Name\": \"再生套餐\",\n" +
                "                \"ProjectList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"形体塑造\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"美体类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:18:00+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:18:00+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:18:00+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:18:00+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"激光美白\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"仪器类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"ProductList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"活力丹\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"养颜\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"玫瑰精华乳\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"CreatedAt\": \"2020-03-02T21:18:00+08:00\",\n" +
                "                \"UpdatedAt\": \"2020-03-02T21:18:00+08:00\"\n" +
                "            },\n" +
                "            {\n" +
                "                \"Id\": 3,\n" +
                "                \"Name\": \"永葆青春套餐\",\n" +
                "                \"ProjectList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"异域风情\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"异域风情\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"经典妆容\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"化妆类护理\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"ProductList\": [\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"活力丹\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"养颜\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"玫瑰精华乳\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"美白水\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"美白\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"润肤精油\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 4,\n" +
                "                        \"Name\": \"活力丹\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 3,\n" +
                "                            \"Name\": \"养颜\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 3,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 3,\n" +
                "                        \"Name\": \"玫瑰精华乳\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 1,\n" +
                "                        \"Name\": \"美白水\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 2,\n" +
                "                            \"Name\": \"美白\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 2,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                    },\n" +
                "                    {\n" +
                "                        \"Id\": 2,\n" +
                "                        \"Name\": \"润肤精油\",\n" +
                "                        \"Type\": {\n" +
                "                            \"Id\": 1,\n" +
                "                            \"Name\": \"护肤\",\n" +
                "                            \"CreatedAt\": \"2020-03-02T21:17:58+08:00\",\n" +
                "                            \"UpdatedAt\": \"2020-03-02T21:17:58+08:00\"\n" +
                "                        },\n" +
                "                        \"TypeId\": 1,\n" +
                "                        \"CreatedAt\": \"2020-03-02T21:17:59+08:00\",\n" +
                "                        \"UpdatedAt\": \"2020-03-02T21:17:59+08:00\"\n" +
                "                    }\n" +
                "                ],\n" +
                "                \"CreatedAt\": \"2020-03-02T21:17:57+08:00\",\n" +
                "                \"UpdatedAt\": \"2020-03-02T21:17:57+08:00\"\n" +
                "            }\n" +
                "        ],\n" +
                "        \"CreatedAt\": \"2020-03-02T21:18:00+08:00\",\n" +
                "        \"UpdatedAt\": \"2020-03-02T21:18:00+08:00\"\n" +
                "    },\n" +
                "    {\n" +
                "        \"Id\": 3,\n" +
                "        \"Name\": \"最后一次这样行不行\",\n" +
                "        \"Age\": 45,\n" +
                "        \"Meallist\": null,\n" +
                "        \"CreatedAt\": \"2020-03-08T10:54:19+08:00\",\n" +
                "        \"UpdatedAt\": \"2020-11-02T16:10:46+08:00\"\n" +
                "    }\n" +
                "]";
        StringEntity jsonEntity = new StringEntity(params, "UTF-8");
        jsonEntity.setContentType("text/json");
        httpPost.setEntity(jsonEntity);

        try {
            CloseableHttpResponse response = client.execute(httpPost);
            HttpEntity entity = response.getEntity();
            if (entity != null) {
                // 利用从HttpEntity中得到的String生成JsonObject
                Map<String, Object> result = JSON.parseObject(EntityUtils.toString(entity));
                System.out.println("resultXyApi：" + result);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
